home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Shape Smash / shape-smash.swf / scripts / Code / LIB / _ct751.as < prev    next >
Encoding:
Text File  |  2010-05-14  |  4.8 KB  |  174 lines

  1. package Code.LIB
  2. {
  3.    import Code.LIB.SOUND._bu111;
  4.    import flash.display.Bitmap;
  5.    import flash.events.Event;
  6.    import flash.events.MouseEvent;
  7.    import flash.filters.DropShadowFilter;
  8.    import flash.geom.Rectangle;
  9.    
  10.    public class _ct751 extends _dk430
  11.    {
  12.       public static const stNoAction:int = 0;
  13.       
  14.       public static const stMoveDown:int = 1;
  15.       
  16.       public static const stMoveUp:int = 2;
  17.       
  18.       private var mount:Bitmap;
  19.       
  20.       private var id:String;
  21.       
  22.       private var label:_wy567;
  23.       
  24.       protected var hitSp:_be548;
  25.       
  26.       private var state:int;
  27.       
  28.       private var iWidth:Number;
  29.       
  30.       private var iHeight:Number;
  31.       
  32.       public function _ct751(param1:Bitmap, param2:_wy567, param3:Boolean = true, param4:Number = -1, param5:Number = -1, param6:String = "")
  33.       {
  34.          var _loc7_:_be548 = null;
  35.          super();
  36.          id = param6;
  37.          this.iHeight = param5;
  38.          this.iWidth = param4;
  39.          if(param1)
  40.          {
  41.             this.mount = param1;
  42.             this.addChild(mount);
  43.          }
  44.          _loc7_ = new _be548();
  45.          _loc7_.graphics.beginFill(16711680,0);
  46.          if(param5 > 0)
  47.          {
  48.             _loc7_.graphics.drawRect(0,0,param4 * _rs402._oy577,param5 * _rs402._oy577);
  49.          }
  50.          else
  51.          {
  52.             _loc7_.graphics.drawRect(0,0,this.mount.width,this.mount.height);
  53.          }
  54.          _loc7_.graphics.endFill();
  55.          this.hitSp = _loc7_;
  56.          if(param2)
  57.          {
  58.             this.label = param2;
  59.             this._xs48 = this.label.iText.text;
  60.             this.addChild(label);
  61.          }
  62.          this.addChild(_loc7_);
  63.          hitArea = _loc7_;
  64.          if(param3)
  65.          {
  66.             this.filters = [new DropShadowFilter(18 * _rs402._oy577,45,0,0.8,30 * _rs402._oy577,30 * _rs402._oy577,0.4 * _rs402._oy577)];
  67.          }
  68.          this.alpha = 1;
  69.          this.buttonMode = true;
  70.       }
  71.       
  72.       override public function _fl204(param1:MouseEvent) : void
  73.       {
  74.          if(param1.target == _en365)
  75.          {
  76.             this.State = stMoveDown;
  77.          }
  78.       }
  79.       
  80.       public function set _xs48(param1:String) : void
  81.       {
  82.          var _loc2_:Rectangle = null;
  83.          var _loc3_:Rectangle = null;
  84.          var _loc4_:Number = NaN;
  85.          this.label.Text = param1;
  86.          _loc2_ = this.label.iText.getCharBoundaries(0);
  87.          _loc3_ = this.label.iText.getCharBoundaries(label.iText.text.length - 1);
  88.          if(this.iWidth < 0)
  89.          {
  90.             this.label.x = (this.mount.width - _loc3_.right) / 2;
  91.             this.label.y = (this.mount.height - _loc2_.height) / 2;
  92.          }
  93.          else
  94.          {
  95.             _loc4_ = iWidth * _rs402._oy577;
  96.             this.label.x = (iWidth * _rs402._oy577 - label.width * _rs402._oy577) / 2 + 4;
  97.             this.label.y = 0;
  98.             this.label.x = (iWidth * _rs402._oy577 - _loc3_.right) / 2.2;
  99.             this.label.y = (iHeight * _rs402._oy577 - _loc2_.height) / 2.2;
  100.          }
  101.       }
  102.       
  103.       public function get ID() : String
  104.       {
  105.          if(id == null)
  106.          {
  107.             return "i dont have ID";
  108.          }
  109.          return id.substr(0,id.length);
  110.       }
  111.       
  112.       override public function _nu62(param1:MouseEvent) : void
  113.       {
  114.          super._ah123(param1);
  115.          if(this.alpha > 0)
  116.          {
  117.             this.alpha = 1;
  118.          }
  119.       }
  120.       
  121.       override public function _ah123(param1:MouseEvent) : void
  122.       {
  123.          super._ah123(param1);
  124.          if(this.alpha > 0.85)
  125.          {
  126.             this.alpha = 0.85;
  127.          }
  128.       }
  129.       
  130.       override public function onEnterFrame(param1:Event) : void
  131.       {
  132.          super.onEnterFrame(param1);
  133.          switch(state)
  134.          {
  135.             case stNoAction:
  136.                break;
  137.             case stMoveDown:
  138.                this.scaleX = this.scaleY = this.scaleY - 0.055;
  139.                if(this.scaleY < 0.9)
  140.                {
  141.                   this.State = stMoveUp;
  142.                }
  143.                break;
  144.             case stMoveUp:
  145.                this.scaleX = this.scaleY = this.scaleY + 0.025;
  146.                if(this.scaleX >= 1)
  147.                {
  148.                   this.State = stNoAction;
  149.                }
  150.          }
  151.       }
  152.       
  153.       private function set State(param1:int) : void
  154.       {
  155.          this.state = param1;
  156.          switch(state)
  157.          {
  158.             case stNoAction:
  159.                this.scaleX = 1;
  160.                this.scaleY = 1;
  161.                break;
  162.             case stMoveDown:
  163.                _bu111._wu209("button");
  164.          }
  165.       }
  166.       
  167.       public function get _en365() : _be548
  168.       {
  169.          return this.hitSp;
  170.       }
  171.    }
  172. }
  173.  
  174.